/* 添加数据按钮 */
.add-data-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-round);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-sm);
    margin-left: auto;  /* 保持向右对齐 */
    margin-top: 10px;   /* 新增上边距 */
    margin-bottom: 20px;   /* 新增上边距 */
}

.add-data-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.add-data-btn svg {
    width: 16px;
    height: 16px;
}

/* 模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background-color: var(--dark-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: var(--transition-normal);
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    border-bottom: 1px solid var(--divider);
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-round);
    transition: var(--transition-fast);
}

.modal-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.modal-close-btn svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.modal-body {
    padding: var(--space-md);
}

/* 表单样式 */
.modal-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.form-row {
    display: flex;
    gap: var(--space-md);
}

.form-row .form-group {
    flex: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon svg {
    position: absolute;
    left: var(--space-md);
    color: var(--text-secondary);
}

.input-with-icon input,
.input-with-icon textarea,
.input-with-icon select {
    width: 100%;
    padding: 10px 10px 10px 40px;
    background: var(--dark-surface);
    border: 1px solid var(--divider);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    transition: var(--transition-normal);
}

.input-with-icon input:focus,
.input-with-icon textarea:focus,
.input-with-icon select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

textarea {
    min-height: 100px;
    resize: vertical;
    padding: var(--space-md) !important;
}

.select-with-icon {
    position: relative;
}

.select-with-icon svg {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    z-index: 1;
}

.select-with-icon select {
    padding-left: calc(var(--space-md) * 2 + 18px) !important;
   /*  appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");  */
    background-repeat: no-repeat;
    background-position: right var(--space-md) center;
    background-size: 16px;
    width: 100%;
    padding: 8px;
}

/* 文件上传样式 */
.file-upload {
    position: relative;
}

.file-upload-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px;
    background: var(--dark-surface);
    border: 1px dashed var(--divider);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-normal);
}

.file-upload-label:hover {
    border-color: var(--primary);
    background: rgba(76, 175, 80, 0.1);
}

.file-upload-label svg {
    color: var(--primary);
}

.file-upload input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* 错误消息 */
.error-message {
    display: none;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background-color: rgba(239, 35, 60, 0.1);
    color: var(--danger);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-top: var(--space-xs);
}

.error-message.active {
    display: flex;
}

.error-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
}

.error-close-btn svg {
    width: 14px;
    height: 14px;
    color: var(--danger);
}

/* 表单操作按钮 */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--divider);
    flex-direction: column-reverse;
    gap: var(--space-sm);
}

.cancel-btn {
    padding: var(--space-md) var(--space-lg);
    background: var(--dark-surface);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-normal);
}

.cancel-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.submit-btn {
    display: flex;
    align-items: center;
    justify-content: center; /* 添加这一行确保水平居中 */
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
    text-align: center; /* 对于 flex 容器，text-align 可能不会生效，可以保留或移除 */
}

.submit-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.submit-btn svg {
    width: 18px;
    height: 18px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        padding: var(--space-sm);
    }

    .form-row {
        flex-direction: column;
        gap: var(--space-md);
    }

    .form-actions {
        flex-direction: column;
    }

    .cancel-btn,
    .submit-btn {
        width: 100%;
        text-align: center;
    }
}